#pragma once

#include "Structures.h"
#include "PFile.h"

#include <Windows.h>
#include <WindowsX.h>

#include <iostream>
#include <fstream>
#include <string>

namespace Proton 
{
	namespace Managers
	{
		class PScheduler;
		class GraphicsManager;

		using namespace std;

		class PlatformManager
		{
			PScheduler* pScheduler;
			GraphicsManager* pGraphics;

			HWND windowHandle;
			ofstream logStream;

			static LRESULT CALLBACK msgRouter(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
		public:
			PlatformManager();
			~PlatformManager(void);

			LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

			void initialize(HINSTANCE _hInstance, LPCSTR lpCmdLine, int iCmdShow, PScheduler* _pScheduler, GraphicsManager* _pGraphics);

			HWND getWindowHandle();
			
			void messageBox(LPCWSTR title, LPCWSTR message);

			void releaseResources();

			
			void log(std::string message);
			void log(const char* message);
			bool syncReadFile(PFile* pPFile);
			bool syncWriteFile(PFile* pPFile);
		};
	}
}

